package com.spring.sunflower.conversation

import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.spring.sunflower.R
import com.spring.sunflower.event.ChatSendGiftEvent

/**
 * Created by Kevin on 2021/12/12<br/>
 *
 * Describe:<br/>
 */
class ChatSendGiftAdapter(layoutResId: Int, data: MutableList<ChatSendGiftEvent.GiftListBean>) :
    BaseQuickAdapter<ChatSendGiftEvent.GiftListBean, BaseViewHolder>(layoutResId, data) {
    override fun convert(holder: BaseViewHolder, item: ChatSendGiftEvent.GiftListBean) {
        Glide.with(context)
            .load(item.imagePath)
            .placeholder(R.drawable.ic_placeholder)
            .into(holder.getView(R.id.ivGift))
        holder.setText(R.id.tvPrice, "${item.price}")
//        var tvPrice = holder.getView<TextView>(R.id.tvPrice)
//        if (item.vipDonate == "0") {
//            tvDonate.visibility = View.INVISIBLE
//        } else {
//            tvDonate.visibility = View.VISIBLE
//            tvDonate.text = "VIP赠送${item.money}"
//        }


//        var tvCornerMark = holder.getView<TextView>(R.id.tvCornerMark)
//        if (item.firstValid == "1") {
//            tvCornerMark.visibility = View.VISIBLE
//        } else {
//            tvCornerMark.visibility = View.GONE
//        }
        val llContainer = holder.getView<LinearLayout>(R.id.llContainer)
//        val ivChecked = holder.getView<ImageView>(R.id.iv_checked)
        if (item.isChecked) {
            llContainer.background = context.getDrawable(R.drawable.bg_shape_send_chat_gift)
        } else {
            llContainer.background = null
        }


    }
}